package model.boardlist;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;

public class BoardListDao {
	private SqlMapClient sqlMapClient;

	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}

	/**
	 * boardlist 의 게시물 이름을 불러오는 메서드
	 * 
	 * @return
	 * @throws SQLException
	 */
	public List<BoardListVO> boardList() throws SQLException {
		return sqlMapClient.queryForList("boardList");
	}

	/**
	 * 게시판 추가 메서드
	 * 
	 * @param blvo
	 * @throws SQLException
	 */
	public void addBoard(BoardListVO blvo) throws SQLException {
		sqlMapClient.insert("addBoard", blvo);

	}

	/**
	 * board_order의 최대 값을 가져오는 메서드
	 * 
	 * @param id
	 * @return
	 * @throws SQLException
	 */
	public Object maxBoardOrder(String id) throws SQLException {
		return sqlMapClient.queryForObject("maxBoardOrder", id);
	}

	public void delBoard(int bno) throws SQLException {
		sqlMapClient.delete("delBoard", bno);
	}

	public void delBoardList(int bno) throws SQLException {
		sqlMapClient.delete("delBoardList", bno);
	}

	public void boardNameModify(BoardListVO blvo) throws SQLException {
		sqlMapClient.update("boardNameModify", blvo);
	}

	public void boardOrderModify(HashMap map) throws SQLException {
		sqlMapClient.update("boardOrderModify", map);

	}
}
